/*
 * @Date: 2022-03-01 14:44:58
 * @Author: 陶子
 * @LastEditTime: 2022-07-11 16:01:08
 * @FilePath: \jk_one-stop_pc\src\views\workManagement\productTask\allColumn.js
 * @pageName: 这是--(生产任务配置列)--页面
 *
 *
 */

import { APILX } from '@/api/requestLx'
import { getOrderStatus } from '@api/productOrder'
import { getDictModel } from '@/api/goodsManagement'

export let columns = [
  {
    title: '工单编号',
    align: 'left',
    dataIndex: 'orderCode',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'orderCode'
    }
  },
  {
    title: '物品编号',
    align: 'left',
    dataIndex: 'serialCode',
    ellipsis: true,
    width: 200,

    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialCode'
    }
  },
  {
    title: '物品名称',
    align: 'left',
    dataIndex: 'serialName',
    ellipsis: true,
    width: 200,

    scopedSlots: { filterDropdown: 'searchDropdown', filterIcon: 'searchIcon', customRender: 'serialName' }
  },
  {
    title: '规格 ',
    align: 'left',
    dataIndex: 'serialSpecifications',
    ellipsis: true,
    width: 200,

    scopedSlots: { filterDropdown: 'searchDropdown', filterIcon: 'searchIcon', customRender: 'serialSpecifications' }
  },
  {
    title: '单位',
    dataIndex: 'unitName',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'unitName' }
  },
  {
    title: '工序编号',
    dataIndex: 'processesCode',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'processesCode' }
  },
  {
    title: '工序名称',
    dataIndex: 'processesName',
    ellipsis: true,
    width: 200,

    scopedSlots: { filterDropdown: 'selectDropdown', filterIcon: 'selectIcon', customRender: 'processesName' }
  },
  {
    title: '计件单价',
    align: 'left',
    dataIndex: 'pieceRate',
    ellipsis: true,
    width: 200,
    scopedSlots:{}
  },
  {
    title: '计划数',
    dataIndex: 'planNum',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'planNum' }
  },
  {
    title: '报工数',
    dataIndex: 'reportNum',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'reportNum' }
  },
  {
    title: '合格数',
    dataIndex: 'qualifiedNum',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'qualifiedNum' }
  },
  {
    title: '不合格数',
    align: 'left',
    dataIndex: 'unqualifiedNum',
    ellipsis: true,
    width: 200,

    scopedSlots: {
      customRender: 'unqualifiedNum'
    }
  },
  {
    title: '任务时间',
    dataIndex: 'planStartTime',
    ellipsis: true,
    width: 300,
    scopedSlots: {
      customRender: 'planStartTime'
    }
  },
  {
    title: '关联订单',
    align: 'left',
    dataIndex: 'saleOrderCode',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'saleOrderCode' }
  },
  {
    title: '工单状态',
    align: 'left',
    dataIndex: 'orderStatus',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'selectDropdown',
      filterIcon: 'selectIcon',
      customRender: 'orderStatus'
    }
  },
  {
    title: '不合格原因',
    align: 'left',
    dataIndex: 'unqualifiedNotes',
    ellipsis: true,
    width: 200,

    scopedSlots: {
      customRender: 'unqualifiedNotes'
    }
  },
  {
    title: '创建时间',
    align: 'left',
    dataIndex: 'createTime',
    sorter: true,
    ellipsis: true,
    width: 200,
    searchIndex: 'createTime',
    scopedSlots: {
      filterDropdown: 'dateRangePicker',
      filterIcon: 'searchIcon',
      customRender: 'createTime'
    }
  },
  {
    title: '更新时间',
    align: 'left',
    dataIndex: 'updateTime',
    ellipsis: true,
    sorter: true,
    width: 200,
    searchIndex: 'updateTime',
    scopedSlots: {
      filterDropdown: 'dateRangePicker',
      filterIcon: 'searchIcon',
      customRender: 'updateTime'
    }
  },
  {
    title: '创建人',
    align: 'left',
    dataIndex: 'createByText',
    ellipsis: true,
    width: 200,
    searchIndex: 'createBy',
    scopedSlots: {
      filterDropdown: 'selectPeople1',
      filterIcon: 'dateIcon',
      customRender: 'createByText'
    }
  },
  {
    title: '更新人',
    align: 'left',
    dataIndex: 'updateByText',
    ellipsis: true,
    width: 200,
    searchIndex: 'updateBy',
    scopedSlots: {
      filterDropdown: 'selectPeople1',
      filterIcon: 'dateIcon',
      customRender: 'updateByText'
    }
  }
]
export let allColumn = [
  {
    title: '工单编号',
    align: 'left',
    dataIndex: 'orderCode',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'orderCode'
    }
  },
  {
    title: '物品编号',
    align: 'left',
    dataIndex: 'serialCode',
    ellipsis: true,
    width: 200,

    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialCode'
    }
  },
  {
    title: '物品名称',
    align: 'left',
    dataIndex: 'serialName',
    ellipsis: true,
    width: 200,

    scopedSlots: { filterDropdown: 'searchDropdown', filterIcon: 'searchIcon', customRender: 'serialName' }
  },
  {
    title: '规格 ',
    align: 'left',
    dataIndex: 'serialSpecifications',
    ellipsis: true,
    width: 200,

    scopedSlots: { filterDropdown: 'searchDropdown', filterIcon: 'searchIcon', customRender: 'serialSpecifications' }
  },
  {
    title: '单位',
    dataIndex: 'unitName',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'unitName' }
  },
  {
    title: '工序编号',
    dataIndex: 'processesCode',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'processesCode' }
  },
  {
    title: '工序名称',
    dataIndex: 'processesName',
    ellipsis: true,
    width: 200,

    scopedSlots: { filterDropdown: 'selectDropdown', filterIcon: 'selectIcon', customRender: 'processesName' }
  },
  {
    title: '计件单价',
    dataIndex: 'pieceRate',
    ellipsis: true,
    width: 200,
    scopedSlots:{}
  },
  {
    title: '计划数',
    dataIndex: 'planNum',
    ellipsis: true,
    width: 200,
    scopedSlots: { customRender: 'planNum' }
  },
  {
    title: '报工数',
    dataIndex: 'reportNum',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'reportNum' }
  },
  {
    title: '合格数',
    dataIndex: 'qualifiedNum',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'qualifiedNum' }
  },
  {
    title: '不合格数',
    align: 'left',
    dataIndex: 'unqualifiedNum',
    ellipsis: true,
    width: 200,

    scopedSlots: {
      customRender: 'unqualifiedNum'
    }
  },
  {
    title: '任务时间',
    dataIndex: 'planStartTime',
    ellipsis: true,
    width: 300,
    scopedSlots: {
      customRender: 'planStartTime'
    }
  },
  {
    title: '关联订单',
    align: 'left',
    dataIndex: 'saleOrderCode',
    ellipsis: true,
    width: 200,

    scopedSlots: { customRender: 'saleOrderCode' }
  },
  {
    title: '工单状态',
    align: 'left',
    dataIndex: 'orderStatus',
    ellipsis: true,
    width: 200,
    scopedSlots: {
      filterDropdown: 'selectDropdown',
      filterIcon: 'selectIcon',
      customRender: 'orderStatus'
    }
  },
  {
    title: '不合格原因',
    align: 'left',
    dataIndex: 'unqualifiedNotes',
    ellipsis: true,
    width: 200,

    scopedSlots: {
      customRender: 'unqualifiedNotes'
    }
  },
  {
    title: '创建时间',
    align: 'left',
    dataIndex: 'createTime',
    sorter: true,
    ellipsis: true,
    width: 200,
    scopedSlots: {
      customRender: 'createTime'
    }
  },
  {
    title: '更新时间',
    align: 'left',
    dataIndex: 'updateTime',
    ellipsis: true,
    sorter: true,
    width: 200,
    scopedSlots: {
      customRender: 'updateTime'
    }
  },
  {
    title: '创建人',
    align: 'left',
    dataIndex: 'createByText',
    ellipsis: true,
    width: 200,
    searchIndex: 'createBy',
    scopedSlots: {
      filterDropdown: 'selectPeople1',
      filterIcon: 'dateIcon',
      customRender: 'createByText'
    }
  },
  {
    title: '更新人',
    align: 'left',
    dataIndex: 'updateByText',
    ellipsis: true,
    width: 200,
    searchIndex: 'updateBy',
    scopedSlots: {
      filterDropdown: 'selectPeople1',
      filterIcon: 'dateIcon',
      customRender: 'updateByText'
    }
  }
]

export let columnshand = [
  {
    title: '工单编号',
    dataIndex: 'orderCode',
    ellipsis: true,
    align: 'left',
    // fixed: 'left',
    searchIndex: 'orderCode',
    width: 200,
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'orderCode'
    }
  },
  {
    title: '物品编号',
    dataIndex: 'serialNumber',
    ellipsis: true,
    width: 200,
    searchIndex: 'serialNumber',
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialNumber'
    }
  },
  {
    title: '物品名称',
    dataIndex: 'serialName',
    ellipsis: true,
    width: 200,
    searchIndex: 'serialName',
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialName'
    }
  },
  {
    title: '规格',
    dataIndex: 'serialSpecifications',
    ellipsis: true,
    width: 200,
    searchIndex: 'serialSpecifications',
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'serialSpecifications'
    }
  },
  {
    title: '状态',
    dataIndex: 'orderStatusText',
    ellipsis: true,
    width: 200,
    searchIndex: 'orderStatus',
    options: [],
    // scopedSlots: {
    //   filterDropdown: 'selectDropdown',
    //   filterIcon: 'dateIcon',
    //   customRender: 'orderStatusText'
    // }
  },
  {
    title: '生产进度',
    dataIndex: 'orderStatusList',
    // ellipsis: true,
    width: 200,
    scopedSlots: {
      // filterDropdown: 'selectDropdown',
      customRender: 'orderStatusList'
    }
  },
  {
    title: '单位',
    dataIndex: 'unitName',
    ellipsis: true,
    width: 200,
    scopedSlots: {}
  },
  {
    title: '计划生产数量',
    dataIndex: 'planProduceNum',
    ellipsis: true,
    width: 200,
    scopedSlots: {}
  },
  {
    title: '计划时间',
    dataIndex: 'timePeriod',
    ellipsis: true,
    width: 200,
    searchIndex: 'timePeriod',
    scopedSlots: {
      // filterDropdown: 'dateRangePicker',
      // filterIcon: 'dateIcon',
      customRender: 'timePeriod'
    }
  },

  // {
  //   title: '已生产数量',
  //   dataIndex: 'goodsName',
  //   ellipsis: true,
  //   width: 200,
  // },
  {
    title: '已生产数量',
    dataIndex: 'qualifiedNumEnd',
    ellipsis: true,
    width: 200,
  },
  {
    title: '关联订单',
    dataIndex: 'sellOrderCode',
    ellipsis: true,
    width: 200,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    ellipsis: true,
    width: 200,
    sorter: true,
    scopedSlots: {}
  },
  {
    title: '更新时间',
    dataIndex: 'updateTime',
    ellipsis: true,
    width: 200,
    sorter: true,
    scopedSlots: {}
  },
  {
    title: '创建人',
    dataIndex: 'createByText',
    ellipsis: true,
    width: 180,
    searchIndex: 'createBys',
    options: [],
    scopedSlots: {
      filterDropdown: 'selectPeople1',
      filterIcon: 'dateIcon'
      // customRender: 'createByName',
    }
  },
  {
    title: '更新人',
    dataIndex: 'updateByText',
    ellipsis: true,
    width: 180,
    options: [],
    searchIndex: 'updateBys',
    scopedSlots: {
      filterDropdown: 'selectPeople2',
      filterIcon: 'dateIcon'
      // customRender: 'createByName',
    }
  },
  // {
  //   title: '创建人',
  //   dataIndex: 'createByText',
  //   ellipsis: true,
  //   width: 200,
  //   scopedSlots: {}
  // },
  // {
  //   title: '更新人',
  //   dataIndex: 'updateByText',
  //   ellipsis: true,
  //   width: 200,
  //   scopedSlots: {}
  // }
]

export async function getTypeList() {


  await getOrderStatus().then((res) => {
    if (res.code == 200) {
      let options = res.result.map((el) => {
        return {
          value: el.value,
          key: el.value,
          label: el.text
        }
      })
      columnshand[4].options = options
    }
  })

}